/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package merlion.mrp.ppm.session;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collection;
import javax.ejb.Local;
import merlion.mrp.ppm.entity.SalesForecast;
import merlion.mrp.ppm.pojo.LabelNValue;

/**
 *
 * @author Zhang Ying
 */
@Local
public interface SalesForecastingSessionLocal {

    public boolean checkPendingForecasts(int year, int month);

    public boolean checkExistedForecasts(int year, int month);

    public ArrayList<ArrayList<Long>> getPreviousTotalSales(Long selectedYear, boolean firstHalf);

    public ArrayList<ArrayList<Long>> getPreviousPromotion(Long selectedYear, boolean firstHalf);

    public ArrayList<Long> getPreviousIndustryTotalDemand(Long selectedYear, boolean firstHalf);

    public ArrayList<Integer> getStaticPeriods(Long selectedYear, boolean firstHalf);

    public ArrayList<Integer> getAllStaticPeriods(int currentYear, int currentMonth);

    public ArrayList<ArrayList<Long>> getAllProductsActualDemands(int currentYear, int currentMonth);

    public ArrayList<ArrayList<Long>> getAllProductDesDemand(ArrayList<Integer> allStaticPeriods, ArrayList<Double> trend,ArrayList<Double> level);

    public ArrayList<ArrayList<Double>> getAllProductDesFactor(ArrayList<ArrayList<Long>> allDesDemand, ArrayList<ArrayList<Long>> allActualDemands);

    public ArrayList<ArrayList<Double>> getLinearRegressResultLnT(ArrayList<ArrayList<Long>> allDesDemandFromActual, ArrayList<Integer> allStaticPeriods);

    public ArrayList<ArrayList<Double>> getAllProductEstimDesFactor(ArrayList<ArrayList<Double>> allDesFactor, ArrayList<Integer> pdicities);

    public ArrayList<ArrayList<Long>> getAllProductDesDemandFromActual(ArrayList<ArrayList<Long>> allActualDemands, ArrayList<Integer> pdicities);

    public boolean persistSalesForecast(SalesForecast newSalesForecast, Long staffId);

    public Collection<SalesForecast> getAllSalesForecast();
    
    public SalesForecast getSalesForecastFromIdStr(String selectedSFId);

    public boolean checkValidForecastId(String selectedSFId);

    public boolean saveEditedSalesForecast(SalesForecast selectedSF);

    public ArrayList<LabelNValue> getMovAverage(Integer selectedProductId,Timestamp currentTime, Integer movingAvgIndexN);
    
}
